<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Flow: flow::error::Runtime_error Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Flow<span id="projectnumber">&#160;2.0.0</span>
   </div>
   <div id="projectbrief">Flow project: Public API.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceflow.html">flow</a></li><li class="navelem"><a class="el" href="namespaceflow_1_1error.html">error</a></li><li class="navelem"><a class="el" href="classflow_1_1error_1_1Runtime__error.html">Runtime_error</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classflow_1_1error_1_1Runtime__error-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">flow::error::Runtime_error Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p>An <code>std::runtime_error</code> (which is an <code>std::exception</code>) that stores an <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">Error_code</a>.  
 <a href="classflow_1_1error_1_1Runtime__error.html#details">More...</a></p>

<p><code>#include &lt;error.hpp&gt;</code></p>

<p>Inherits boost::system::system_error.</p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a6c54ae5dfbfb4c53edcccee96b69bfcb"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1error_1_1Runtime__error.html#a6c54ae5dfbfb4c53edcccee96b69bfcb">Runtime_error</a> (const <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09">Error_code</a> &amp;err_code_or_success, <a class="el" href="namespaceflow_1_1util.html#ae4dc52186797094b3040379ff19124c9">util::String_view</a> context=&quot;&quot;)</td></tr>
<tr class="memdesc:a6c54ae5dfbfb4c53edcccee96b69bfcb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs <a class="el" href="classflow_1_1error_1_1Runtime__error.html" title="An std::runtime_error (which is an std::exception) that stores an Error_code.">Runtime_error</a>.  <a href="classflow_1_1error_1_1Runtime__error.html#a6c54ae5dfbfb4c53edcccee96b69bfcb">More...</a><br /></td></tr>
<tr class="separator:a6c54ae5dfbfb4c53edcccee96b69bfcb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae21a0dfb7a523134d7068f255f0c1c63"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1error_1_1Runtime__error.html#ae21a0dfb7a523134d7068f255f0c1c63">Runtime_error</a> (<a class="el" href="namespaceflow_1_1util.html#ae4dc52186797094b3040379ff19124c9">util::String_view</a> context)</td></tr>
<tr class="memdesc:ae21a0dfb7a523134d7068f255f0c1c63"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs <a class="el" href="classflow_1_1error_1_1Runtime__error.html" title="An std::runtime_error (which is an std::exception) that stores an Error_code.">Runtime_error</a>, when one only has a context string and no applicable/known error code.  <a href="classflow_1_1error_1_1Runtime__error.html#ae21a0dfb7a523134d7068f255f0c1c63">More...</a><br /></td></tr>
<tr class="separator:ae21a0dfb7a523134d7068f255f0c1c63"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97483cadd78d55c6ac8c192d6433f598"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1error_1_1Runtime__error.html#a97483cadd78d55c6ac8c192d6433f598">what</a> () const noexcept override</td></tr>
<tr class="memdesc:a97483cadd78d55c6ac8c192d6433f598"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a message describing the exception.  <a href="classflow_1_1error_1_1Runtime__error.html#a97483cadd78d55c6ac8c192d6433f598">More...</a><br /></td></tr>
<tr class="separator:a97483cadd78d55c6ac8c192d6433f598"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >An <code>std::runtime_error</code> (which is an <code>std::exception</code>) that stores an <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">Error_code</a>. </p>
<p >We derive from <a class="el" href="namespaceboost_1_1system.html" title="We may add some ADL-based overloads into this namespace outside flow.">boost.system</a>'s <code>system_error</code> which already does that nicely. This polymorphic subclass merely improves the <code><a class="el" href="classflow_1_1error_1_1Runtime__error.html#a97483cadd78d55c6ac8c192d6433f598" title="Returns a message describing the exception.">what()</a></code> message a little bit &ndash; specially handling the case when there is no <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">Error_code</a>, or it is falsy &ndash; but is otherwise identical.</p>
<h3>Rationale</h3>
<p >It is questionable whether <a class="el" href="classflow_1_1error_1_1Runtime__error.html" title="An std::runtime_error (which is an std::exception) that stores an Error_code.">Runtime_error</a> is really necessary. One can equally well simply throw <code>boost::system::system_error(err_code, context)</code> when <code>bool(err_code) == true</code>, and <code>std::runtime_error(context)</code> otherwise. Indeed the user should feel 100% free to do that if desired. <a class="el" href="classflow_1_1error_1_1Runtime__error.html" title="An std::runtime_error (which is an std::exception) that stores an Error_code.">flow::error::Runtime_error</a> is mere syntactic sugar for code brevity, when one indeed has an <code>err_code</code> that may or may not be falsy: they can just construct+throw a <a class="el" href="classflow_1_1error_1_1Runtime__error.html" title="An std::runtime_error (which is an std::exception) that stores an Error_code.">Runtime_error</a> and not worry about the bifurcation. In the end one likely just catches <code>std::exception exc</code> and logs/prints <code>exc.what()</code>: how precisely it was thrown is of low import, typically. <a class="el" href="classflow_1_1error_1_1Runtime__error.html" title="An std::runtime_error (which is an std::exception) that stores an Error_code.">Runtime_error</a> provides a concise way (with some arguable niceties like the use of <code>String_view</code>) to throw it when desired. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a6c54ae5dfbfb4c53edcccee96b69bfcb" name="a6c54ae5dfbfb4c53edcccee96b69bfcb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6c54ae5dfbfb4c53edcccee96b69bfcb">&#9670;&nbsp;</a></span>Runtime_error() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">flow::error::Runtime_error::Runtime_error </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09">Error_code</a> &amp;&#160;</td>
          <td class="paramname"><em>err_code_or_success</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceflow_1_1util.html#ae4dc52186797094b3040379ff19124c9">util::String_view</a>&#160;</td>
          <td class="paramname"><em>context</em> = <code>&quot;&quot;</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructs <a class="el" href="classflow_1_1error_1_1Runtime__error.html" title="An std::runtime_error (which is an std::exception) that stores an Error_code.">Runtime_error</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">err_code_or_success</td><td>The <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">Error_code</a> describing the error if available; or the success value (<code><a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">Error_code()</a></code>) if an error code is unavailable or inapplicable to this error. In the latter case <a class="el" href="classflow_1_1error_1_1Runtime__error.html#a97483cadd78d55c6ac8c192d6433f598" title="Returns a message describing the exception.">what()</a> will omit anything to do with error codes and feature only <code>context</code>. </td></tr>
    <tr><td class="paramname">context</td><td>String describing the context, i.e., where/in what circumstances the error occurred/what happened. For example: "Peer_socket::receive()" or "Server_socket::accept() while checking
       state," or a string with line number and file info. Try to keep it brief but informative. <a class="el" href="util__fwd_8hpp.html#a0cc4c82ac54e53b7a8a2431b66ff30df" title="Same as FLOW_UTIL_WHERE_AM_I() but evaluates to an std::string.">FLOW_UTIL_WHERE_AM_I_STR()</a> may be helpful. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ae21a0dfb7a523134d7068f255f0c1c63" name="ae21a0dfb7a523134d7068f255f0c1c63"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae21a0dfb7a523134d7068f255f0c1c63">&#9670;&nbsp;</a></span>Runtime_error() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">flow::error::Runtime_error::Runtime_error </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceflow_1_1util.html#ae4dc52186797094b3040379ff19124c9">util::String_view</a>&#160;</td>
          <td class="paramname"><em>context</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructs <a class="el" href="classflow_1_1error_1_1Runtime__error.html" title="An std::runtime_error (which is an std::exception) that stores an Error_code.">Runtime_error</a>, when one only has a context string and no applicable/known error code. </p>
<p >Formally it's equivalent to <code>Runtime_error(Error_code(), context)</code>: it is syntactic sugar only.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>See the other ctor. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a97483cadd78d55c6ac8c192d6433f598" name="a97483cadd78d55c6ac8c192d6433f598"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97483cadd78d55c6ac8c192d6433f598">&#9670;&nbsp;</a></span>what()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const char * flow::error::Runtime_error::what </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">override</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns a message describing the exception. </p>
<p >Namely:</p><ul>
<li>If no/success <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">Error_code</a> passed to ctor: Message includes <code>context</code> only.</li>
<li>If non-success <a class="el" href="namespaceflow.html#a29eaaa9d0fac4ce87d8b969222dbed09" title="Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...">Error_code</a> passed to ctor: Message includes: numeric value of <code>Error_code</code>, a brief string representing the code category to which it belongs, the system message corresponding to the <code>Error_code</code>, and <code>context</code>.</li>
</ul>
<dl class="section return"><dt>Returns</dt><dd>See above. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>error/<a class="el" href="error_2error_8hpp.html">error.hpp</a></li>
<li>error/<a class="el" href="error_2error_8cpp.html">error.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 28 2025 22:55:32 for Flow by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
